﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FTradeReceivablesListEasyUI.aspx.cs" Inherits="IHISCETeim.Web.MachineSys.FTradeModel.FTradeReceivablesListEasyUI" %>
<%--应收账款主表--%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../EasyUI/themes/default/easyui.css"/>
	<link rel="stylesheet" type="text/css" href="../EasyUI/themes/icon.css" />
	<script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>   
	<script type="text/javascript" src="../EasyUI/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../EasyUI/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="../EasyUI/easyui-formatter_20140718.js?v2"></script>
     <link href="../themes/css/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
    <script src="../js/DWZ/jquery.autocomplete.js" type="text/javascript"></script>
    <script src="../js/DWZ/jquery.inputValue.js" type="text/javascript"></script>
    <script type="text/javascript">
        ///自适应宽高
       $(window).resize(function(){
             $("#ftr_easyui_tabs").tabs({
                tabPosition:"bottom",
                 width: '100%',
                 height: $(parent.document).find(".tabsPageContent").height()-5> 0 ? $(parent.document).find(".tabsPageContent").height()-5  : 500,
            });  
              $("#tab_list").datagrid({
                    width: '100%',
                    height: $("#ftr_easyui_tabs").height()-35,
             }); 
	    });
        //权限处理
        var $powers={
            "r查看":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.查看) %>,
            "r新增":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.新增) %>,
            "r修改":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.修改) %>,
            "r删除":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.删除) %>,
            "r导出":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.导出) %>,
            "r应收帐款_维修保养费":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.应收帐款_维修保养费) %>,
            "r应收帐款_发票":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.应收帐款_发票) %>,
            "r应收帐款_操作":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.应收帐款_操作) %>,
            "r应收帐款_缓期":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.应收帐款_缓期) %>,
            "r应收帐款_导出_营业人员":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.应收帐款_导出_营业人员) %>
        };
        var $tabpanle2_isload=0;
        var $tabpanle3_isload=0;
        $(document).ready(function () {  
            $("#ftr_easyui_tabs").tabs({
                 tabPosition:"bottom",
                 width: '100%',
                 height: $(parent.document).find(".tabsPageContent").height()-5  > 0 ? $(parent.document).find(".tabsPageContent").height()-5  : 500,
                 onSelect:function(title,index){
                   // alert(index);
                   if(index==1 && $tabpanle2_isload==0)
                   {
                      // alert($tabpanle2_isload);
                       InitGird2(); $tabpanle2_isload=1;
                   }
                   if(index==2 && $tabpanle3_isload==0)
                   {
                       InitGird3(); $tabpanle3_isload=1;
                   }

                 }
            });        
            //权限处理
            var $tab_toolbar=$("#tab_toolbar");
            $tab_toolbar.find("a").each(function(){
                var $per=$(this).attr("Permission");
                var pt= $powers[$per]==undefined || null?true:$powers[$per];
                $(this).linkbutton(pt?'enable': 'disable');
               
                if($(this).attr("menu")!=undefined && (pt==false))
                {
                    $(this).menubutton({
					    disabled:true
				    });
                }
                 
            })
           
            //自动完成
            $(".autocomplete").each(function () {
                var $this = $(this);
                var url = unescape($this.attr("autocompletehref"));
                $this.autocomplete(url);
            });
            //加载数据
            InitGird();  
            $("#tab_list").datagrid({
                    width: '100%',
                    height: $("#ftr_easyui_tabs").height()-35,
             }); 
            //周报日期选择           
            $('#FTradeReceivablesListEasyUIExportDialog').dialog({
				buttons:[{
					text:'确定导出',
					iconCls:'icon-ok',
                    plain:"true" ,
					handler:function(){
						var href = "<%= ExportExcelWebUrl%>/FTradeModel/FTradeExportWeekReport.aspx?"+ jQuery.param($("#FTradeReceivablesListEasyUIExportDialog").serializeJSON());;
                        top.window.open(href, "");
                        $('#FTradeReceivablesListEasyUIExportDialog').dialog('close');
					}
				},{
					text:'关闭',
                    plain:"true" ,
					handler:function(){
						$('#FTradeReceivablesListEasyUIExportDialog').dialog('close');
					}
				}]
			});
            $('#FTradeReceivablesListEasyUIExportDialog').dialog('close');


            //发票日期选择           
            $('#FTradeReceivablesListEasyUIExportInvoiceDialog').dialog({
				buttons:[{
					text:'确定导出',
					iconCls:'icon-ok',
                    plain:"true" ,
					handler:function(){
						var href = "<%= ExportExcelWebUrl%>/FTradeModel/FTradeExportInvoice.aspx?"+ jQuery.param($("#FTradeReceivablesListEasyUIExportInvoiceDialog").serializeJSON());;
                        top.window.open(href, "");
                        $('#FTradeReceivablesListEasyUIExportInvoiceDialog').dialog('close');
					}
				},{
					text:'关闭',
                    plain:"true" ,
					handler:function(){
						$('#FTradeReceivablesListEasyUIExportInvoiceDialog').dialog('close');
					}
				}]
			});
            $('#FTradeReceivablesListEasyUIExportInvoiceDialog').dialog('close');

             //var price = 11.11;
             //checkPrice(price );
             function checkPrice(price){
                 return (/^(([0-9]\d*)|\d)(\.\d{1,2})?$/).test(price.toString());
              }
            ///调整GPS 
             $('#FTradeReceivablesListEasyUIGPSDialog').dialog({
				buttons:[{
					text:'确定调整',
					iconCls:'icon-ok',
                    plain:"true" ,
					handler:function(){
                        var row = $('#tab_list').datagrid('getSelected')
                        var newmaxgpsfy=row.GPSFeiYong;
                        var $newgpsfeiyong=$("#FTradeReceivablesListEasyUIGPSDialog_NewGPSFeiYong").val();

//                        if(checkPrice($newgpsfeiyong)==false)
//                        {
//                            alert("请输入正常的调整金额");
//                            return false;
//                        }

                        
////                        if(parseFloat($newgpsfeiyong)<=0)
////                        {
////                            alert("调整金额必需大于0");
////                            return false;
////                        }

//                        if(parseFloat($newgpsfeiyong)>parseFloat(newmaxgpsfy))
//                        {
//                            alert("最多只能调整"+newmaxgpsfy+"元");
//                            return false;
//                        }
						//var FTradeID = row.FTradeID;
                        var url = "FTradeModel/FTradeReceivablesListEasyUI.aspx?action=editrow&FTradeID=" + row.FTradeID+"&newgpsfeiyong="+encodeURI($newgpsfeiyong);                       
                        $("#tab_list").datagrid("load"); 
                        top.ajaxTodo(url, "");
                        $('#FTradeReceivablesListEasyUIGPSDialog').dialog('close');

                        $('#tab_list').datagrid('unselectAll')//取消选中,不然会直接选中上次的数据
					}
				},{
					text:'关闭',
                    plain:"true" ,
					handler:function(){
						$('#FTradeReceivablesListEasyUIGPSDialog').dialog('close');
					}
				}]
			});
            $('#FTradeReceivablesListEasyUIGPSDialog').dialog('close');
            $("#FTradeReceivablesListEasyUIGPSDialog_NewGPSFeiYong").inputFloat();

             //收款收据日期选择           
            $('#FTradeCatheringListEasyUIExportDialogSKSJ').dialog({
                buttons:[{
                    text:'确定导出',
                    iconCls:'icon-ok',
                    plain:"true" ,
                    handler:function(){
                      <%--  var href = "<%= ExportExcelWebUrl%>/FTradeModel/FTradeExportSKSJ.aspx?"+ jQuery.param($("#FTradeCatheringListEasyUIExportDialogSKSJ").serializeJSON());;
					    top.window.open(href, "");
					    $('#FTradeCatheringListEasyUIExportDialogSKSJ').dialog('close');--%>

					    var href = "<%= ExportExcelWebUrl%>/FTradeModel/FTradeExportUpKeep.aspx?" + jQuery.param($("#FTradeCatheringListEasyUIExportDialogSKSJ").serializeJSON());
                        top.window.open(href, "");
                        $('#FTradeCatheringListEasyUIExportDialogSKSJ').dialog('close');

                        return false;

					}
				},{
				    text:'关闭',
				    plain:"true" ,
				    handler:function(){
				        $('#FTradeCatheringListEasyUIExportDialogSKSJ').dialog('close');
				    }
				}]
            });
        })
        //加载列表数据
        function InitGird() {
            $('#tab_list').datagrid({               
                url: location.href, //请求数据的页面
                sortName: 'XiaoShouShiJian', //排序字段
                sortOrder: 'desc', //排序类型
                idField: 'FTradeID', //标识字段,主键
                iconCls: '', //标题左边的图标
                width: '100%', //宽度    
                height: $("#ftr_easyui_tabs").height()-35,
                nowrap: true, //是否换行，True 就会把数据显示在一行里
                striped: true, //True 奇偶行使用不同背景色
                collapsible: false, //可折叠
                singleSelect: true, //是否只能选中一条
                remoteSort: true, //定义是否从服务器给数据排序
                frozenColumns: [[//冻结的列，不会随横向滚动轴移动
                	{ title: '合同号', field: 'HeTongHao', width: 110, sortable: true,formatter:function(value, row, index){
                            if(row.HeTongHao==undefined)
                                return "";
                            return '<a href="#"  title="查看应收帐款明细信息" onclick="onViewClick(\''+row.FTradeID+'\'); return false;">'+value+'</a>';//事件处理
                        }
                    },
                    {title: '销售时间', field: 'XiaoShouShiJian', width: 70,formatter:formatterdate , sortable: true},
                    {title: '营业经理', field: 'YingYeJingLi', width: 70, sortable: true},
                    {title: '经销商', field: 'JingXiaoShang', width: 80 , sortable: true},
                    {title: '机号', field: 'JiHao', width:60 , sortable: true,formatter:function(value, row, index){
                             if(value==undefined)
                                return "合计:";
                            //事件处理
                            return '<a href="#"  title="查看已冲帐明细信息" onclick="onViewBalanceByJiHaoClick(\''+value+'\'); return false;">'+value+'</a>';
                        }
                    }
                    
				]],
                columns: [[   
                    {title: '数量', field: 'ShuLiang', width:50 , sortable: true},
                    {title: '机器状态', field: 'JiQiState', width: 60, sortable: true,formatter:function(value, row, index){
                            if(value=="正常")
                                return "一般销售";
                            return value;
                        }
                    },                
                    { title: '型号', field: 'XingHao', width: 90, sortable: true},
                    { title: '单价', field: 'Price', width: 80, sortable: true,formatter:milliformatter },
                    { title: 'GPS费用', field: 'GPSFeiYong', width: 70, sortable: true,formatter:milliformatter},
                    { title: '折让金额', field: 'YueCuXiaoJinE', width: 80, sortable: true,formatter:milliformatter },
                    { title: '合同金额', field: 'HeTongJinE', width: 80, sortable: true,formatter:milliformatter},
                    { title: '到期日', field: 'DaoQiRi', width: 90, sortable: true },
                    { title: '已收', field: 'YiShouKuanXiang', width: 90, sortable: true,formatter:milliformatter},
                    { title: '未收', field: 'WeiShouKuanXiang', width: 90, sortable: true,formatter:milliformatter},
                    { title: '逾期', field: 'YuQiKuanXiang', width: 90, sortable: true,formatter:milliformatter},
                    { title: '收款条款', field: 'XiaoShouLeiXing', width: 120, sortable: true},
                    { title: '合同付款条款', field: 'FuKuanTiaoKuan', width: 120, sortable: true},
                    { title: '返还利息额', field: 'FanHuanLiXi', width: 90, sortable: true,formatter:milliformatter},
                    { title: '返还利息状态', field: 'FanHuanLiXiState', width: 120, sortable: true,formatter:function(value, row, index){
                        if(value=='空')
                            return "";
                        if(value==undefined)
                            return "-";
                        if(value=="逾期(未结算)")
                            return "<a href='#' style='color:red;font-weight:bold;' onclick=\"onClickFanHuanLiXiState("+row.FTradeID+",'"+value+"',"+row.FanHuanLiXi+","+index+")\">逾期(未结算)</a>";
                            //return "<b style='color:red;'>逾期</b>";
                        if(value=="正常(已结算)")
                            return "<b style='color:green;' title='"+row.FanHuanDate+"'>正常(已结算)</b>";
                        <%if(HasPower(IHISCETeim.Web.Permission.应收帐款_返还利息)){ %>
                        if(value=="正常(未结算)")
                            return "<a href='#' onclick=\"onClickFanHuanLiXiState("+row.FTradeID+",'"+value+"',"+row.FanHuanLiXi+","+index+")\">正常(未结算)</a>";
                        <%} %>
                        return value;
                    }},
                    { title: '返还时间', field: 'FanHuanDate', width: 90, sortable: true},
                    { title: '终端销售状态', field: 'ZDXiaoShouState', width: 90, sortable: true},
                    { title: '终端销售时间', field: 'ZDXiaoShouShiJian', width: 90, sortable: true},
                    { title: '终端用户', field: 'ZDYongHu', width: 90, sortable: true},
                    { title: '维保费', field: 'UpKeepJinE', width: 90, sortable: true,formatter:milliformatter},
                     { title: '合同原件', field: 'HeTongYuanJian', width: 90, sortable: true},
                      { title: '收货凭证', field: 'ShouHouYuanJian', width: 90, sortable: true},
                    { title: 'ID', field: 'FTradeID', width: 90, sortable: true}
                ]],
                toolbar: "#tab_toolbar",
                queryParams: { "action": "query" },
                pagination: true, //是否开启分页
                pageNumber: 1, //默认索引页
                pageSize: <%=numPerPage %>, //默认一页数据条数
                pageList:<%=SetnumPerPage() %>,
                rownumbers: true, //行号
                showFooter: true,
                rowStyler:function(index,row)
                {
                    if(row.JiQiState!="正常")
                        return  "color:red;";  
                },
                onHeaderContextMenu: function(e, field){
					e.preventDefault();
					if (!$('#tmenu').length){
						createColumnMenu();
					}
					$('#tmenu').menu('show', {
						left:e.pageX,
						top:e.pageY
					});
				},
                onRowContextMenu:function(e,rowIndex,rowData)
                {
                    e.preventDefault();
					if (!$('#tmenu').length){
						createColumnMenu();
					}
					$('#tmenu').menu('show', {
						left:e.pageX,
						top:e.pageY
					});
                }
            });

        }  
       /*显示列*/
       var ColumnFields={'JingXiaoShang':"经销商"};
       function createColumnMenu(){
			var tmenu = $('<div id="tmenu" style="width:150px;"></div>').appendTo('body');
			var fields = $('#tab_list').datagrid('getColumnFields');
			for(var i=0; i<fields.length; i++){
				$('<div data-options="name:\''+fields[i]+'\',iconCls:\'icon-ok\'" />').html($('#tab_list').datagrid('getColumnOption',fields[i]).title).appendTo(tmenu);
			}
			tmenu.menu({
				onClick: function(item){
					if (item.iconCls=='icon-ok'){                       
						$('#tab_list').datagrid('hideColumn', item.name);
						tmenu.menu('setIcon', {
							target: item.target,
							iconCls: 'icon-empty'
						});
					} else {
						$('#tab_list').datagrid('showColumn', item.name);
						tmenu.menu('setIcon', {
							target: item.target,
							iconCls: 'icon-ok'
						});
					}
				}
			});
		}

       //显示透视表数据
       function InitGird2() {
         $('#tab_list2').datagrid({               
                url: location.href, //请求数据的页面
                sortName: 'JingXiaoShang', //排序字段
                sortOrder: 'desc', //排序类型
                idField: 'JingXiaoShang', //标识字段,主键
                iconCls: '', //标题左边的图标
                width: '100%', //宽度    
                height: $("#ftr_easyui_tabs").height()-35,
                nowrap: true, //是否换行，True 就会把数据显示在一行里
                striped: true, //True 奇偶行使用不同背景色
                collapsible: false, //可折叠
                singleSelect: true, //是否只能选中一条
                remoteSort: true, //定义是否从服务器给数据排序
                columns: [[   
                    {title: '经销商', field: 'JingXiaoShang', width: 100 , sortable: true,formatter:function(value, row, index){
                         if(value==undefined)
                                return "合计:";
                        return "<a href='#' onclick=\"onDataGrid2RowClick('"+value+"')\">"+value+"</a>"
                        
                    }},
                    {title: '数量', field: 'ShuLiang', width:50 , sortable: true},
                    { title: '合同金额', field: 'HeTongJinE', width: 120, sortable: true,formatter:milliformatter},
                    { title: '已收', field: 'YiShouKuanXiang', width: 120, sortable: true,formatter:milliformatter},
                    { title: '未收', field: 'WeiShouKuanXiang', width: 120, sortable: true,formatter:milliformatter},
                    { title: '逾期', field: 'YuQiKuanXiang', width: 120, sortable: true,formatter:milliformatter},
                ]],
                queryParams: { "action": "query2" },
                pagination: false, //是否开启分页
                pageNumber: 1, //默认索引页
                pageSize: <%=numPerPage %>, //默认一页数据条数
                pageList:<%=SetnumPerPage() %>,
                rownumbers: true, //行号
                showFooter: true,
            });
       }
        //加载列表数据
        function InitGird3() {
            $('#tab_list3').datagrid({               
                url: location.href, //请求数据的页面
                sortName: 'JingXiaoShang', //排序字段
                sortOrder: 'desc', //排序类型
                idField: 'JingXiaoShang', //标识字段,主键
                iconCls: '', //标题左边的图标
                width: '100%', //宽度    
                height: $("#ftr_easyui_tabs").height()-35,
                nowrap: true, //是否换行，True 就会把数据显示在一行里
                striped: true, //True 奇偶行使用不同背景色
                collapsible: false, //可折叠
                singleSelect: true, //是否只能选中一条
                remoteSort: false, //定义是否从服务器给数据排序
                frozenColumns: [[//冻结的列，不会随横向滚动轴移动
                	
                ]],
                columns: [ 
                    
                    [
                        { title: ' ',colspan:1},
                        {title:'18VX',colspan:2},
                        {title:'40NS',colspan:2},
                        {title:'55NSL',colspan:2},
                        {title:'65NSL',colspan:2},
                         {title:'68NS',colspan:2},
                          {title:'80NS',colspan:2},
                           {title:'100NS',colspan:2},
                           {title:'100NST',colspan:2}
                    ],
                    [
                        { title: '经销商', field: 'JingXiaoShang', width: 120},

                        { title: '销量', field: '18VXShuLiang', width: 60},
                        { title: '合同金额', field: '18VXHeTongJinE', width: 100,formatter:milliformatter},

                         { title: '销量', field: '40NSShuLiang', width: 60},
                        { title: '合同金额', field: '40NSHeTongJinE', width: 100,formatter:milliformatter},

                         { title: '销量', field: '55NSLShuLiang', width: 60},
                        { title: '合同金额', field: '55NSLHeTongJinE', width: 100,formatter:milliformatter},

                         { title: '销量', field: '65NSLShuLiang', width: 60},
                        { title: '合同金额', field: '65NSLHeTongJinE', width: 100,formatter:milliformatter},

                         { title: '销量', field: '68NSShuLiang', width: 60},
                        { title: '合同金额', field: '68NSHeTongJinE', width: 100,formatter:milliformatter},

                         { title: '销量', field: '80NSShuLiang', width: 60},
                        { title: '合同金额', field: '80NSHeTongJinE', width: 100,formatter:milliformatter},

                         { title: '销量', field: '100NSShuLiang', width: 60},
                        { title: '合同金额', field: '100NSHeTongJinE', width: 100,formatter:milliformatter},

                         { title: '销量', field: '100NSTShuLiang', width: 60},
                        { title: '合同金额', field: '100NSTHeTongJinE', width: 100,formatter:milliformatter}
                    ]
                ],
                toolbar: "#tab_toolbar3",
                queryParams: { "action": "query3" },
                pagination: false, //是否开启分页
                pageNumber: 1, //默认索引页
                pageSize: <%=numPerPage %>, //默认一页数据条数
                pageList:<%=SetnumPerPage() %>,
                rownumbers: false, //行号
                showFooter: false                
            });

        } 
    </script>
    <script>
        //操作功能JS

        //打开高级查找窗口
        function onAdjSearch() {
            $("#tab_search").dialog("open");
            $("#search-buttons").find("#btn_search").one("click", function () {
                
                $('#tab_list').datagrid("options").queryParams = getQuery();
                $('#tab_list').datagrid('load');
                $("#tab_search").dialog("close");
                return false;

            });
        }
        //打开高级查找窗口
        function onAdjSearch3() {
            $("#tab_search3").dialog("open");
            $("#search-buttons3").find("#btn_search3").one("click", function () {
                
                $('#tab_list3').datagrid("options").queryParams = getQuery3();
                $('#tab_list3').datagrid('load');
                $("#tab_search3").dialog("close");
                return false;

            });
        }
        //添加
        function onAddClick() {

            var rel = "FTradeReceivablesAdd";
            var url = "FTradeModel/FTradeReceivablesAdd.aspx";
            var title = "新增应收帐款数据源";
            var options = { width: 850, height: 450, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            //top.$.pdialog.open(url, rel, title, options);
            top.navTab.openTab(rel, url, { title: title, fresh: true, external: false });
            return false;
        }
        

        //修改，通过工具栏
        function onEditClick() {

            var row = $('#tab_list').datagrid('getSelected')
            if (row == null) {
                $.messager.alert('提示', '请先选择要修改的应收帐款');
                return false;
            }

//            if (row.JiQiState != "正常") {
//                top.alertMsg.error("对不起,此机器已[" + row.JiQiState + "]不能进行此操作.")
//                return false;
//            }

            var FTradeID = row.FTradeID;
            var rel = "FTradeReceivablesEdit";
            var url = "FTradeModel/FTradeReceivablesEdit.aspx?FTradeID=" + FTradeID;
            var title = "修改应收帐款数据源";
            var options = { width: 850, height: 450, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            top.navTab.openTab(rel, url, { title: title, fresh: true, external: false });

            $('#tab_list').datagrid('unselectAll')//取消选中,不然会直接选中上次的数据
            return false;
        }
        //查看
        function onViewClick(FTradeID) {
            var rel = "FTradeReceivablesView";
            var url = "FTradeModel/FTradeReceivablesView.aspx?FTradeID=" + FTradeID;
            var title = "查看应收帐款数据";
            var options = { width: 850, height: 450, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            //top.$.pdialog.open(url, rel, title, options);
            top.navTab.openTab(rel, url, { title: title, fresh: true, external: false });
            return false;
        }
        function onViewBalanceByJiHaoClick(JiHao) {
            var rel = "ViewBalanceByJiHao";
            var url = "FTradeModel/ViewBalanceByJiHao.aspx?JiHao=" + JiHao;
            var title = "查看[" + JiHao + "]已冲款记录";
            var options = { width: 850, height: 450, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            top.$.pdialog.open(url, rel, title, options);
            //top.navTab.openTab(rel, url, { title: title, fresh: true, external: false });

            return false;
        }
        //改返回利息状态,将未结算==>已结算
        function onClickFanHuanLiXiState(FTradeID, FanHuanLiXiState, FanHuanLiXi, index) {
           

            if (FanHuanLiXiState == "逾期(未结算)") {

                $('#FanHuanLiXiStateWin').window('open');
                $("#FanHuanLiXiState_FTradeID").val(FTradeID);
                $("#FanHuanLiXiState_RowIndex").val(index);
                //$.messager.confirm('提示', '你确定要返还此逾期的合同利息吗?将会还返(' + FanHuanLiXi + ')并更改成已结算', function (r) {
                //    if (r) {
                //        var url = "sysAjaxDone.ashx?ajaxmethod=updateFanHuanLiXiState&FTradeID=" + FTradeID;
                //        top.ajaxTodo(url, "");
                //        $('#tab_list').datagrid('getRows')[index].FanHuanLiXiState = '正常(已结算)';
                //        $('#tab_list').datagrid('refreshRow', index);
                //    }
                //});
            }
            else {
                if (FanHuanLiXiState != "正常(未结算)") {
                    $.messager.alert('提示', '不能将 ' + FanHuanLiXiState + ' 更改成 正常(已结算)');
                    return false;
                }
               
                $.messager.confirm('提示', '您确认要将合同返还利息(' + FanHuanLiXi + ')更改成已结算吗？', function (r) {
                    if (r) {
                        var url = "sysAjaxDone.ashx?ajaxmethod=updateFanHuanLiXiState&FTradeID=" + FTradeID;
                        top.ajaxTodo(url, "");
                        $('#tab_list').datagrid('getRows')[index].FanHuanLiXiState = '正常(已结算)';
                        $('#tab_list').datagrid('refreshRow', index);
                    }
                });
            }
            return false;            
        }
        function FanHuanLiXiStateWinOKClick()
        {
            $.messager.confirm('提示', '你确认要按此状态更改此合同返还利息吗？', function (r) {
                if (r) {
                    var $FTradeID= $("#FanHuanLiXiState_FTradeID").val();
                    var $RowIndex= $("#FanHuanLiXiState_RowIndex").val();
                    var $FanHuanLiXiState= $("#FanHuanLiXiStateWin_LastState").val();
                    var url = "sysAjaxDone.ashx?ajaxmethod=updateFanHuanLiXiState&FTradeID=" + $FTradeID+"&FanHuanLiXiState="+encodeURI($FanHuanLiXiState);
                    top.ajaxTodo(url, "");
                    $('#tab_list').datagrid('getRows')[$RowIndex].FanHuanLiXiState = $FanHuanLiXiState;
                    $('#tab_list').datagrid('refreshRow', $RowIndex);
                    $('#FanHuanLiXiStateWin').window('close');
                }
            })          
        }
        //删除
        function onDelClick() {

            var row = $('#tab_list').datagrid('getSelected')
            if (row == null) {
                $.messager.alert('提示', '请先选择要删除的应收帐款记录');
                return false;
            }
            $('#tab_list').datagrid('unselectAll')//取消选中,不然会直接选中上次的数据
            var FTradeID = row.FTradeID;


            $.messager.confirm('提示', '您确认要删除此应收帐款记录吗？', function (r) {
                if (r) {
                    var FTradeID = row.FTradeID;
                    var url = "sysAjaxDone.ashx?ajaxmethod=deleteftradereceivables&FTradeID=" + FTradeID;
                    top.ajaxTodo(url, "");
                    $("#tab_list").datagrid("load");

                }
            });


            return false;
        }

        function onUpKeepClick() {

            var row = $('#tab_list').datagrid('getSelected')
            if (row == null) {
                $.messager.alert('提示', '请先选择要管理的应收帐款');
                return false;
            }

//            if (row.JiQiState != "正常") {
//                top.alertMsg.error("对不起,此机器已[" + row.JiQiState + "]不能进行此操作.")
//                return false;
//            }

            var FTradeID = row.FTradeID;

            var rel = "FTradeUpKeepList";
            var url = "FTradeModel/FTradeUpKeepList.aspx?FTradeID=" + FTradeID;
            var title = "管理维修保养费数据";
            var options = { width: 850, height: 450, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            //top.$.pdialog.open(url, rel, title, options);
            top.navTab.openTab(rel, url, { title: title, fresh: true, external: false });
            $('#tab_list').datagrid('unselectAll')//取消选中,不然会直接选中上次的数据
            return false;
        }
        /*发票添加*/
        function onInvoiceAddClick() {
            var row = $('#tab_list').datagrid('getSelected')
            if (row == null) {
                $.messager.alert('提示', '请先选择要管理的应收帐款');
                return false;
            }

            var FTradeID = row.FTradeID;

            var rel = "FTradeInvoiceAdd";
            var url = "FTradeModel/FTradeInvoiceAdd.aspx?FTradeID=" + FTradeID;
            var title = "添加发票数据";
            var options = { width: 550, height: 300, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            top.$.pdialog.open(url, rel, title, options);
            //top.navTab.openTab(rel, url, { title: title, fresh: true, external: false });
            $('#tab_list').datagrid('unselectAll')//取消选中,不然会直接选中上次的数据
            return false;
        }
        /*发票维护*/
        function onInvoiceClick() {
            var row = $('#tab_list').datagrid('getSelected')
            if (row == null) {
                $.messager.alert('提示', '请先选择要管理的应收帐款');
                return false;
            }

            var FTradeID = row.FTradeID;

            var rel = "FTradeInvoiceList";
            var url = "FTradeModel/FTradeInvoiceList.aspx?FTradeID=" + FTradeID;
            var title = "管理发票数据";
            var options = { width: 850, height: 450, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            //top.$.pdialog.open(url, rel, title, options);
            top.navTab.openTab(rel, url, { title: title, fresh: true, external: false });
            $('#tab_list').datagrid('unselectAll')//取消选中,不然会直接选中上次的数据
            return false;
        }
        ///变更合同条款，指合同金额不变
        function onChangeHeTongClick() {
            var row = $('#tab_list').datagrid('getSelected')
            if (row == null) {
                $.messager.alert('提示', '请先选择要变更合同条款的记录');
                return false;
            }
            if (row.JiQiState != "正常") {
                top.alertMsg.error("对不起,此机器已[" + row.JiQiState + "]不能进行此操作.")
                return false;
            }

            var FTradeID = row.FTradeID;

            var rel = "FTradeReceivablesChangeHeTong";
            var url = "FTradeModel/FTradeReceivablesChangeHeTong.aspx?FTradeID=" + FTradeID;
            var title = "变更合同条款";
            var options = { width: 850, height: 450, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            //top.$.pdialog.open(url, rel, title, options);
            top.navTab.openTab(rel, url, { title: title, fresh: true, external: false });
            $('#tab_list').datagrid('unselectAll')//取消选中,不然会直接选中上次的数据
            return false;
        }
        ///变更收款条款,合同金额变
        function onChangeSaleTypeClick() {
          
            var row = $('#tab_list').datagrid('getSelected')
            if (row == null) {
                $.messager.alert('提示', '请先选择要改分期的应收帐款');
                return false;
            }
            if (row.JiQiState != "正常") {
                top.alertMsg.error("对不起,此机器已[" + row.JiQiState + "]不能进行此操作.")
                return false;
            }

            var FTradeID = row.FTradeID;

            var rel = "FTradeReceivablesUpdateSaleType";
            var url = "FTradeModel/FTradeReceivablesUpdateSaleType.aspx?FTradeID=" + FTradeID;
            var title = "改分期";
            var options = { width: 850, height: 450, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            //top.$.pdialog.open(url, rel, title, options);
            top.navTab.openTab(rel, url, { title: title, fresh: true, external: false });
            $('#tab_list').datagrid('unselectAll')//取消选中,不然会直接选中上次的数据
            return false;
        }
        ///缓期操作
        function onSuspendClick() {
            var row = $('#tab_list').datagrid('getSelected')
            if (row == null) {
                $.messager.alert('提示', '请先选择要缓期的应收帐款');
                return false;
            }
            if (row.JiQiState != "正常") {
                top.alertMsg.error("对不起,此机器已[" + row.JiQiState + "]不能进行此操作.")
                return false;
            }

            var FTradeID = row.FTradeID;

            var rel = "FTradeAgeDetaiSuspend";
            var url = "FTradeModel/FTradeAgeDetaiSuspend.aspx?FTradeID=" + FTradeID;
            var title = "应收帐款缓期";
            var options = { width: 850, height: 450, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            //top.$.pdialog.open(url, rel, title, options);
            top.navTab.openTab(rel, url, { title: title, fresh: true, external: false });
            $('#tab_list').datagrid('unselectAll')//取消选中,不然会直接选中上次的数据
            return false;
        }
        //退机操作
        function onTuiJiClick() {
            var row = $('#tab_list').datagrid('getSelected')
            if (row == null) {
                $.messager.alert('提示', '请先选择要退机的机器');
                return false;
            }
            if (row.JiQiState != "正常") {
                top.alertMsg.error("对不起,此机器已[" + row.JiQiState + "]不能进行此操作.")
                return false;
            }
            var FTradeID = row.FTradeID;

            var rel = "FTradeReceivablesTuiJi";
            var url = "FTradeModel/FTradeReceivablesTuiJi2.aspx?FTradeID=" + FTradeID;
            var title = "退机操作";
            var options = { width: 850, height: 450, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            //top.$.pdialog.open(url, rel, title, options);
            top.navTab.openTab(rel, url, { title: title, fresh: true, external: false });
            $('#tab_list').datagrid('unselectAll')//取消选中,不然会直接选中上次的数据
            return false;
        }

        function onHuanJiClick() {
            var row = $('#tab_list').datagrid('getSelected')
            if (row == null) {
                $.messager.alert('提示', '请先选择要换机的机器');
                return false;
            }
            if (row.JiQiState != "正常") {
                top.alertMsg.error("对不起,此机器已[" + row.JiQiState + "]不能进行此操作.")
                return false;
            }
            var FTradeID = row.FTradeID;

            var rel = "FTradeReceivablesHuanJi";
            var url = "FTradeModel/FTradeReceivablesHuanJi.aspx?FTradeID=" + FTradeID;
            var title = "换机操作";
            var options = { width: 850, height: 450, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            //top.$.pdialog.open(url, rel, title, options);
            top.navTab.openTab(rel, url, { title: title, fresh: true, external: false });
            $('#tab_list').datagrid('unselectAll')//取消选中,不然会直接选中上次的数据
            return false;
        }
        //改经销商
        function onChangeAgentClick() {
            var row = $('#tab_list').datagrid('getSelected')
            if (row == null) {
                $.messager.alert('提示', '请先选择要改经销商的应收帐款');
                return false;
            }
            if (row.JiQiState != "正常") {
                top.alertMsg.error("对不起,此机器已[" + row.JiQiState + "]不能进行此操作.")
                return false;
            }

            var FTradeID = row.FTradeID;

            var rel = "FTradeReceivablesChangeAgent";
            var url = "FTradeModel/FTradeReceivablesChangeAgent.aspx?FTradeID=" + FTradeID;
            var title = "改经销商";
            var options = { width: 850, height: 450, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            //top.$.pdialog.open(url, rel, title, options);
            top.navTab.openTab(rel, url, { title: title, fresh: true, external: false });
            $('#tab_list').datagrid('unselectAll')//取消选中,不然会直接选中上次的数据
            return false;
        }
        //调整GPS费用
        function onUpdateGPSFeiYong() {
            var row = $('#tab_list').datagrid('getSelected')
            if (row == null) {
                $.messager.alert('提示', '请先选择要调整GPS费用的机器');
                return false;
            }
            if (row.JiQiState != "正常") {
                top.alertMsg.error("对不起,此机器已[" + row.JiQiState + "]不能进行此操作.")
                return false;
            }
            $('#FTradeReceivablesListEasyUIGPSDialog_OldGPSFeiYong').html(row.GPSFeiYong);
            $('#FTradeReceivablesListEasyUIGPSDialog').dialog('open');
            //$('#tab_list').datagrid('unselectAll')//取消选中,不然会直接选中上次的数据
        }
        //导出周报表格式
        function onExportWeekList() {           
             $('#FTradeReceivablesListEasyUIExportDialog').dialog('open');
         }
         //导出发票签收
         function onExportInvoice() {
             $('#FTradeReceivablesListEasyUIExportInvoiceDialog').dialog('open');
         }
        //导出还款提示函
        function onExportHKTSH() {
            var href = "<%= ExportExcelWebUrl%>/FTradeModel/FTradeExportHKTSH.aspx?uid=1" ;
            top.window.open(href, "");
        }
        function onExportLPayLFMee()
        {
            var href = "<%= ExportExcelWebUrl%>/FXModel/FXFinanceLeaseLPayLFMee.aspx?uid=1" ;
            top.window.open(href, "");
        }
        //导出管控表
        function onExportList() {
            var href = "<%= ExportExcelWebUrl%>/FTradeModel/FTradeReceivablesExport.aspx?export2=0&" + jQuery.param(getQuery());
            top.window.open(href, "");
            return false;
        }
          function onExportList2() {
            var href = "<%= ExportExcelWebUrl%>/FTradeModel/FTradeReceivablesExport.aspx?export2=1&" + jQuery.param(getQuery());
            top.window.open(href, "");
            return false;
        }
        //onExportYuanQi
        function onExportYuanQi()
        {
            var href = "<%= ExportExcelWebUrl%>/FTradeModel/FTradeExportYuanQi.aspx?" + jQuery.param(getQuery());
            top.window.open(href, "");
            return false;
        }
        //导出返还利息
        function onExportFanHuanLiXi()
        {
            var href = "<%= ExportExcelWebUrl%>/FTradeModel/FTradeReceivablesExportFanHuanLiXi.aspx?" + jQuery.param(getQuery());
            top.window.open(href, "");
            return false;
        }
        //导出维保费
        function onExportUpKeep(type) {          
            if(type==1)
                $('#FTradeCatheringListEasyUIExportDialogSKSJ').dialog('open');
            if(type==0)
            {
                var href = "<%= ExportExcelWebUrl%>/FTradeModel/FTradeExportUpKeep.aspx?" + jQuery.param(getQuery());
                top.window.open(href, "");
            }
            return false;
        }
        //营业经理导出
        function onExplorHKTSHClick()
        {
            var href = "<%= ExportExcelWebUrl%>/FTradeModel/FTradeExportHKTSH.aspx?uid=<%=User.UserId%>" ;
            top.window.open(href, "");
        }
        //第二个表选择经销商
        function onDataGrid2RowClick(jingXiaoShang) {
            $(".table_search").find("input[name='JingXiaoShang']").val(jingXiaoShang);
            
            $('#tab_list').datagrid("options").queryParams = getQuery();
            $('#tab_list').datagrid('load');
            $("#tab_search").dialog("close");
            //第一个选项卡选中
            $("#ftr_easyui_tabs").tabs("select",0)
            return false;
        }
        //导出发票信息
        function onExportInvoiceInfo() {            
            var href = "<%= ExportExcelWebUrl%>/FTradeModel/FTradeExportInvoiceInfo.aspx?" + jQuery.param(getQuery());
            top.window.open(href, "");
            return false;
        }
        function getQuery()
        {
            var query = $("#tab_search").serializeJSON(); // GetInputData("tab_search", "query");
            //处理多值情况
            var xxx = ""
            $("#tab_search").find("input[name='XiaoShouLeiXing']").each(function () {
                xxx += "" + $(this).val() + ","
            });
            query.XiaoShouLeiXing = xxx;
            xxx = ""
            $("#tab_search").find("input[name='FanHuanLiXiState']").each(function () {
                xxx += "" + $(this).val() + ","
            });
            query.FanHuanLiXiState = xxx;

            query.action = "query";
            return query;
        }
        function getQuery3()
        {
            var query = $("#tab_search3").serializeJSON(); // GetInputData("tab_search", "query");
            //处理多值情况
            var xxx = ""
            $("#tab_search").find("input[name='XiaoShouLeiXing']").each(function () {
                xxx += "" + $(this).val() + ","
            });
            query.XiaoShouLeiXing = xxx;
            xxx = ""
            $("#tab_search3").find("input[name='FanHuanLiXiState']").each(function () {
                xxx += "" + $(this).val() + ","
            });
            query.FanHuanLiXiState = xxx;

            query.action = "query3";
            return query;
        }
    </script>
</head>
<body style="margin:2px;" >
<div id="ftr_easyui_tabs" class="easyui-tabs" data-options="tabPosition:'bottom'" > 
<div title="应收账款数据源" style="padding:0px">
    <div id="tab_list"></div>
    <div id="tab_toolbar" style="padding:2px;">
        <span style="line-height:26px;width:60px; font-weight:bold; color:Red; "><%=base.GetLastUpdate() %></span>
       <a href="#" title="高级查找" class="easyui-linkbutton" iconcls="icon-search" plain="true" onclick="return　onAdjSearch(this);" Permission="">查找</a>

       <a href="#" title="新增应收帐款数据源" class="easyui-linkbutton" iconcls="icon-add" plain="true" onclick="return onAddClick()" Permission="r新增">新增</a>
       <a href="#" title="修改基本信息" class="easyui-linkbutton" iconcls="icon-edit" plain="true" onclick="return　onEditClick();" Permission="r修改">修改</a>
       <a href="#" title="删除" class="easyui-linkbutton" iconcls="icon-remove" plain="true" onclick="return　onDelClick();" Permission="r删除">删除</a> 
      <%-- <a href="#"  class="easyui-linkbutton" iconcls="icon-btnDown" plain="true" onclick="return onExportList();" Permission="r导出">导出</a>
       <a href="#"  class="easyui-linkbutton" iconcls="icon-btnDown" plain="true" onclick="return onExportList();" Permission="r导出">导出本周发车情况</a>--%>
       <a href="#"  class="easyui-menubutton" iconcls="icon-sum"  menu="#FTradeReceivablesListEasyUIInvoiceMenu" Permission="r应收帐款_发票">发票管理</a>  
       <a href="#"  class="easyui-linkbutton" iconcls="icon-btnEditMoney" plain="true" onclick="return onUpKeepClick('');" Permission="r应收帐款_维修保养费">管理维保费</a>       
      <%-- <a href="#"  class="easyui-linkbutton" iconcls="icon-btnDiffAnalyse" plain="true" onclick="return onSuspendClick();" Permission="r应收帐款_缓期">缓期</a>--%>
       
        <a href="javascript:void(0)" id="btnOPMain" class="easyui-menubutton" menu="#FTradeReceivablesListEasyUIOPMenu" iconCls="icon-tip" Permission="r应收帐款_操作">操作</a> 
       <a href="javascript:void(0)" id="btnExportMain" class="easyui-menubutton" menu="#FTradeReceivablesListEasyUIExportMenu" iconCls="icon-btnDown" Permission="r导出">导出</a>  
       <a href="javascript:void(0)"  class="easyui-linkbutton"  iconCls="icon-btnDown" Permission="r应收帐款_导出_营业人员"  plain="true" onclick="return onExplorHKTSHClick()">导出还款提示函(<%=DateTime.Now.Month %>月)</a>

    </div> 

    <div id="FTradeReceivablesListEasyUIInvoiceMenu" style="width:120px;">  
            <div iconCls="icon-add" onclick="return onInvoiceAddClick();">新增发票</div>  
            <div iconCls="icon-edit" onclick="return onInvoiceClick();">发票维护</div>
            <div iconCls="icon-ok" onclick="return onExportInvoiceInfo();">发票导出</div>
    </div> 

    <div id="FTradeReceivablesListEasyUIOPMenu" style="width:120px;">
       <div iconCls="icon-btnsignout" onclick="return　onChangeHeTongClick();" >变更合同条款</div>
       <div iconCls="icon-btnsignout" onclick="return　onChangeSaleTypeClick();" >改分期</div>  
       <div iconCls="icon-btnsignin" onclick="return　onTuiJiClick();" >退机</div>
       <div iconCls="icon-btnsignout" onclick="return　onHuanJiClick();" >换机</div>
       <div iconCls="icon-btnsignin" onclick="return　onChangeAgentClick();" >改经销商</div>
       <div iconCls="icon-btnsignin" onclick="return　onUpdateGPSFeiYong();">退GPS费用</div>

      <%-- <a href="#" title="改分期" class="easyui-linkbutton" iconcls="icon-btnsignout" plain="true" onclick="return　onChangeSaleTypeClick();" Permission="r应收帐款_变更收款条款">改分期</a>
       <a href="#"  class="easyui-linkbutton" iconcls="icon-btnsignout" plain="true" onclick="return onTuiJiClick();" Permission="r应收帐款_退机">退机</a>
       <a href="#"  class="easyui-linkbutton" iconcls="icon-btnsignin" plain="true" onclick="return onHuanJiClick();" Permission="r应收帐款_换机">换机</a>
       <a href="#"  class="easyui-linkbutton" iconcls="icon-btnsignin" plain="true" onclick="return onChangeAgentClick();" Permission="r应收帐款_改经销商">改经销商</a>--%>
    </div>

    <div id="FTradeReceivablesListEasyUIExportMenu" style="width:150px;">  
            <div iconCls="icon-ok" onclick="return onExportList();">1.导出数据源</div> 
         <div iconCls="icon-ok" onclick="return onExportList2();">1.1.导出数据源</div>  
            <div iconCls="icon-ok" onclick="return onExportWeekList();">2.导出周报</div>  
            <div iconCls="icon-ok" onclick="return onExportHKTSH();">3.还款提示函(<%=DateTime.Now.Month %>月)</div>  
            <div iconCls="icon-ok" onclick="return onExportInvoice();">4.发票签收单</div> 
            <div iconCls="icon-ok" onclick="return onExportFanHuanLiXi();">5.经销商返还利息清单</div> 
            <div iconCls="icon-ok" onclick="return onExportUpKeep(1);">6.维修保养费清单(按收费时间)</div>
            <div iconCls="icon-ok" onclick="return onExportUpKeep(0);">6.1.维修保养费清单(按数据源查找条件)</div>
            <div iconCls="icon-ok" onclick="return onExportLPayLFMee();">7.融资首付支付提示函</div>
            <div iconCls="icon-ok" onclick="return onExportYuanQi();">8.延期短缺成本报表</div>
    </div>  
    
    <div id="FTradeReceivablesListEasyUIExportDialog" icon="icon-save" title="选择周报日期"  style="padding:5px;width:400px;height:200px;" modal="true" closed="true">
		<p>请选择要导出的周报日期期间：</p>
		<p>
            从<input name="CreateDateFrom" class="easyui-datebox" type="text" value="<%=CreateDateFrom %>" />
            到<input name="CreateDateTo" type="text" class="easyui-datebox" value="<%=CreateDateTo %>" />
        </p>		
	</div>

    <div id="FTradeReceivablesListEasyUIExportInvoiceDialog" icon="icon-save" title="选择发票日期"  style="padding:5px;width:400px;height:200px;" modal="true" closed="true">
		<p>请选择添加发票的日期期间：</p>
		<p>
            从<input name="CreateDateFrom" class="easyui-datebox" type="text" value="" />
            到<input name="CreateDateTo" type="text" class="easyui-datebox" value="" />
        </p>		
	</div>

    <div id="FTradeReceivablesListEasyUIGPSDialog" icon="icon-save" title="调整GPS费用"  style="padding:5px;width:300px;height:180px;" modal="true" closed="true">
		<b>当前GPS费用是：</b><span style=" font-size:14px;" id="FTradeReceivablesListEasyUIGPSDialog_OldGPSFeiYong">0</span>　　元.<br/>
        <b>调整后的GPS费用：</b><br/><input name="NewGPSFeiYong" id="FTradeReceivablesListEasyUIGPSDialog_NewGPSFeiYong" type="text" value="0" />元<br/>
        <span style="color:Red;">注：调整后,相应费用将自动在最后一条帐龄中扣除.</span>
	</div>

       <div id="FTradeCatheringListEasyUIExportDialogSKSJ" icon="icon-save" title="选择日期"  style="padding:5px;width:400px;height:250px;" modal="true" closed="true">
		<p>请选择要导出的日期(收费时间)区间：</p>
		<p>
            从<input name="InputDateFrom" class="easyui-datebox" type="text" value="" />
            到<input name="InputDateTo" type="text" class="easyui-datebox" value="" />
        </p>		
        <p>
            经销商:<input name="JingXiaoShang" type="text" value="" />
        </p>
	</div>
    <div id="tab_search" title="查询条件" style=" height:300px; width:600px;" class="easyui-dialog" modal="true" closed="true" buttons="#search-buttons">
        <table class="table_search" width="100%" style=" line-height:21px;">
            <tr>
                <td>经销商:</td>
                <td ><input  name="JingXiaoShang"  class="autocomplete" autocompletehref="<%=AutoCompleteRequestUrl %>?ajaxmethod=getagentlist" mustMatch="true" swidth="300" showinputid=""/></td>
                <td>合同号:</td>
                <td Colspan="3"><input  name="HeTongHao" value="" /></td>
            </tr>
            <tr>
                <td>机型:</td>
                <td ><input  name="XingHao" value="" /></td>
                <td></td>
                <td Colspan="3"></td>
            </tr>
            <tr>
                 <td>机号:</td>
                <td><input  name="JiHao" value="" /></td>
                <td>机器状态:</td>
                <td>
                    <select name="JiQiState">
                        <option value="-" selected>所有...</option>
                        <option value="正常" >一般销售</option>
                        <option value="改分期">改分期</option>
                        <option value="改经销商">改经销商</option>
                        <option value="换机">换机</option>
                        <option value="退机">退机</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>收款条款:</td>
                <td colspan="3">
                     <input name="XiaoShouLeiXing"  class="easyui-combobox" data-options="
		                    valueField: 'value',
		                    textField: 'text', multiple:true,width:400,
		                    data: [
                            <%=GetXiaoShouLeiXing() %>
                            ]" />
                </td>
            </tr>
            <tr>
                <td>终端客户:</td>
                <td >
                    <input  name="ZDYongHu" value="" />
                </td>
                <td>营业经理:</td>
                <td >
                    <input  name="YingYeJingLi" value="" />
                </td>

            </tr>

            <tr>
                <td>
                    销售时间：
                </td>
                <td Colspan="3">                    
                    从<input name="XiaoShouShiJianFrom" class="easyui-datebox" type="text" value="" />
                    到<input name="XiaoShouShiJianTo" type="text" class="easyui-datebox" value="" />
                </td>
            </tr>
            <tr>
                <td>
                    返还利息状态：
                </td>
                <td Colspan="3">  
                     <input name="FanHuanLiXiState"  class="easyui-combobox" data-options="
		                    valueField: 'value',
		                    textField: 'text', multiple:true,width:400,
		                    data: [
                                {'text': '所有...','value': ''},
                                {'text': '正常(未结算)','value':'正常(未结算)'},
                                {'text': '正常(已结算)','value':'正常(已结算)'},
                                {'text': '逾期(未结算)','value':'逾期(未结算)'},
                                {'text': '逾期(取消)','value':'逾期(取消)'}
                            ]" />  
                </td>
            </tr>
            <tr>
                <td>
                    返还时间 ：
                </td>
                <td Colspan="3">                    
                    从<input name="FanHuanDateFrom" class="easyui-datebox" type="text" value="" />
                    到<input name="FanHuanDateTo" type="text" class="easyui-datebox" value="" />
                </td>
            </tr>
        </table>
        <div id="search-buttons">
            <a id="btn_search" href="javascript:;" class="easyui-linkbutton" iconcls="icon-search" plain="true">提交</a> 
            <a href="javascript:;" class="easyui-linkbutton" onclick="$('#tab_search').dialog('close');return false;" iconcls="icon-cancel" plain="true">取消</a>
        </div>
    </div>
    <%--返利利息状态更改--%>
    <div id="FanHuanLiXiStateWin" class="easyui-window"  title="更改逾期(未结算)利息状态" data-options="modal:true,closed:true,iconCls:'icon-save',minimizable:false,maximizable:false,draggable:false" style="width:400px;height:150px;padding:10px;">
        <div class="easyui-layout" data-options="fit:true">            
            <div data-options="region:'center'" style="padding:10px;">
                请选择逾期(未结算)利息 最终状态:
                <select id="FanHuanLiXiStateWin_LastState"  name="FanHuanLiXiStateWin_LastState" style="width:100px;">
                    <option value="逾期(取消)" selected>逾期(取消)</option>
                    <option value="正常(已结算)">正常(已结算)</option>
                </select>
                <input id="FanHuanLiXiState_FTradeID" value="0" type="hidden" />
                <input id="FanHuanLiXiState_RowIndex" value="0" type="hidden" />
            </div>
            <div data-options="region:'south',border:false" style="text-align:right;padding:5px 0 0;">
                <a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="javascript:FanHuanLiXiStateWinOKClick()" style="width:80px">Ok</a>
                <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="javascript:$('#FanHuanLiXiStateWin').window('close')" style="width:80px">Cancel</a>
            </div>
        </div>
    </div>
</div>
<div title="应收账款汇总表" style="padding:0px">
    <div id="tab_list2"></div>
</div>
<div title="经销商机型销售明细表" style="padding:0px">
    <div id="tab_list3"></div>
     <div id="tab_toolbar3" style="padding:2px;">         
         <a href="#" title="高级查找" class="easyui-linkbutton" iconcls="icon-search" plain="true" onclick="return　onAdjSearch3(this);" Permission="">查找</a>
     </div>
    <div id="tab_search3" title="查询条件" style=" height:100px; width:500px;" class="easyui-dialog" modal="true" closed="true" buttons="#search-buttons3">
        <table class="table_search" width="100%" style=" line-height:21px;">
            <tr>
                <td>
                    销售时间：
                </td>
                <td>                    
                    从<input name="XiaoShouShiJianFrom" class="easyui-datebox" type="text" value="" />                    
                </td>
                <td>
                    到<input name="XiaoShouShiJianTo" type="text" class="easyui-datebox" value="" />
                </td>
            </tr>           
        </table>
        <div id="search-buttons3">
            <a id="btn_search3" href="javascript:;" class="easyui-linkbutton" iconcls="icon-search" plain="true">提交</a> 
            <a href="javascript:;" class="easyui-linkbutton" onclick="$('#tab_search').dialog('close');return false;" iconcls="icon-cancel" plain="true">取消</a>
        </div>
    </div>
</div>
</div>
</body>
</html>